package com.satchi.struts.form;

import org.apache.struts.action.ActionForm;

import com.satchi.struts.ActionHelper;

public class GetInvoiceForm extends ActionForm {
	private String customer;
	private Integer isClosed;
	private String date_Begin;
	private String date_End;
	private String toExcel;
	private String[] customers;
	
	public String[] getCustomers() {
		return customers;
	}
	public void setCustomers(String[] customers) {
		this.customers = customers;
	}
	public String getToExcel() {
		return toExcel;
	}
	public void setToExcel(String toExcel) {
		this.toExcel = toExcel;
	}
	public String getCustomer() {
		return customer;
	}
	public void setCustomer(String customer) {
		this.customer = customer;
	}
	public Integer getIsClosed() {
		return isClosed;
	}
	public void setIsClosed(Integer isClosed) {
		this.isClosed = isClosed;
	}
	public String getDate_Begin() {
		return date_Begin;
	}
	public void setDate_Begin(String date_Begin) {
		this.date_Begin = date_Begin;
	}
	public String getDate_End() {
		return date_End;
	}
	public void setDate_End(String date_End) {
		this.date_End = date_End;
	}
	
	public boolean getIsMuliti(){
		return customer.indexOf(",") > -1;
	}
	public String getFormatCustomer(){
		if (getIsMuliti()) {
			StringBuffer ids = new StringBuffer();
			for (String id : getCustomers()) {
				ids.append(id);
				ids.append(",");
			}
			ids.deleteCharAt(ids.length() - 1);
			return ids.toString();
		} else {
			return getCustomer();
		}
	}
}
